//package com.telit.firecommand.service.impl;
//
//import cn.hutool.core.date.DateUtil;
//import com.telit.common.entity.PageData;
//import com.telit.common.util.CommonUtil;
//import com.telit.common.util.DateUtils;
//import com.telit.common.util.RedisUtil;
//import com.telit.firecommand.dao.CommFireAlarmDao;
//import com.telit.firecommand.dao.CommWatchmanSetDao;
//import com.telit.firecommand.dto.*;
//import com.telit.firecommand.entity.CommWatchManSet;
//import com.telit.firecommand.service.AttendInfoService;
//import com.telit.firecommand.service.FireAlarmsService;
//import com.telit.firecommand.service.FireQueryService;
//import com.telit.firecommand.service.WatchmanService;
//import com.telit.firecommand.vo.OperationVO;
//import com.telit.firecommand.vo.WatchManFireCountVO;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.*;
//
///**
// * Create by Chencf 2023/01/05
// */
//
//@Service
//@Slf4j
//public class WatchmanServiceImpl implements WatchmanService {
//
//
//    @Autowired
//    private CommFireAlarmDao commFireAlarmDao;
//
//    @Autowired
//    private CommWatchmanSetDao commWatchmanSetDao;
//
//    @Autowired
//    private AttendInfoService attendInfoService;
//
//    @Autowired
//    private FireAlarmsService fireAlarmsService;
//
//    @Autowired
//    private FireQueryService fireQueryService;
//    @Autowired
//    private ForesterService foresterService;
//
//
//
//    //值守员点击误报按钮
//    @Override
//    public void misreport(MisreportFireDTO misreportFireDTO) {
//        if (misreportFireDTO.getFireJudgmentType()==1){
//            misreportFireDTO.setStatus(1);
//            misreportFireDTO.setIsReadWork(1);
//        }
//        commFireAlarmDao.misreport(misreportFireDTO.getFireJudgmentType(),misreportFireDTO.getStatus(),misreportFireDTO.getFireId());
//    }
//
//    @Override
//    public List<CommWatchManSet> isFilter( String districtCode) {
//        List<CommWatchManSet> result = (List<CommWatchManSet>)RedisUtil.getObject("FIRE:WATCHMAN:SET");
//        if (result != null) {
//            return result;
//        }
//          List<CommWatchManSet> list = commWatchmanSetDao.selectAll(districtCode);
//            RedisUtil.setObject("FIRE:WATCHMAN:SET", list);
//
//        return list;
//    }
//
//    //一旦修改直接删除
//    @Override
//    public void updateWatchManSet(CommWatchManSetDTO dto) {
//        //删除原有数据
//        RedisUtil.delete("FIRE:WATCHMAN:SET");
//        CommWatchManSet commWatchManSet = new CommWatchManSet();
//        commWatchManSet.setId(dto.getId());
//        commWatchManSet.setIsOpen(dto.getIsOpen());
//        commWatchManSet.setIsOpenDistrictCode(dto.getIsOpenDistrictCode());
//        commWatchmanSetDao.updateById(commWatchManSet);
//    }
//
//    @Override
//    public List<WatchManFireCountVO> watchManFireCount(WatchFireCountDTO dto) {
//        Date beginOfDay=null;
//        Date endOfDay=null;
//        if (StringUtils.isNotBlank(dto.getDate())){
//            Date date = DateUtils.getDate(dto.getDate(), DateUtils.DATE_FORMAT);
//             beginOfDay = DateUtil.beginOfDay(date);
//             endOfDay = DateUtil.endOfDay(date);
//        }
//        Set<Integer> statusList=new HashSet<>();
//        if (StringUtils.isNotBlank(dto.getStatusStr())){
//            statusList = CommonUtil.convertNumberSet(dto.getStatusStr());
//        }
//        //查询总的
//        List<WatchManFireCountVO> vo = commFireAlarmDao.watchManFireCount(dto.getDistrictCode(), statusList, beginOfDay, endOfDay);
//       Integer  count = commFireAlarmDao.watchManAllFireCount(dto.getDistrictCode(), statusList, beginOfDay, endOfDay);
//         vo.forEach(watchManFireCountVO -> watchManFireCountVO.setAllCount(count));
//        return vo;
//    }
//
//
//    @Override
//    public AttendStatisticsDTO reportDutyCount(ReportDutyCountDTO dto) {
//        AttendStatisticsDTO attendStatisticsDTO = attendInfoService.qryAttendStatistics(null, dto.getDistrictCode(),   DateUtils.getDate(dto.getDate(), DateUtils.DATE_FORMAT));
//        return attendStatisticsDTO;
//    }
//
//    @Override
//    public void fireTrackByFireId(String fireId) {
//        //查询火情处置信息
//        List<OperationVO> operationVOS = fireAlarmsService.fireOperatorLog(fireId);
//        List<Long> hlyIdList = new ArrayList<>();
//        //先根据火情id查询相关的护林员
//        PageData pageData = foresterService.findForesterByFireId(fireId);
//        List<Map<String, String>> datas = (List<Map<String, String>>)pageData.getDatas();
//        //拿到护林员消息
//        for (Map map:datas){
//           hlyIdList.add( Long.parseLong(map.get("personId").toString()));
//        }
//
//        //再根据护林员查询相关的任务消息
//        List<TaskFeedbackInfoDTO> taskFeedbackInfoList=new ArrayList<>();
//        for (Long hlyId:hlyIdList) {
//            List<TaskFeedbackInfoDTO> taskFeedbackInfoDTOS = fireQueryService.queryTaskFeedbackInfo(Long.parseLong(fireId), hlyId);
//            taskFeedbackInfoList.addAll(taskFeedbackInfoDTOS);
//        }
//        //将任务消息排序
//
//
//
//
//    }
//
//}
